10. Text: Combining Data Recap
Text Recap of the Previous Video
Combining data
Often you're going to want to combine data from multiple sources, such as different tables in a database or sheets in an Excel file. For example, you might want to include the information from the People sheet with the Orders sheet so you can analyze the performance of each salesperson.
In Tableau, you can do this by dragging multiple sheets into the top panel. You get two different outcomes depending on where you drag it, a union or a join.
Union
If you drag People below Orders, you get a union. Unions stack the data on top of each other, the second sheet ends up being appended to the end of the first sheet. This works great if you have multiple sheets with columns in common as the columns will match up. However if the columns are different, then you'll get a lot of "nulls" because columns are created for both sheets, but the first sheet doesn't have data for the second sheet's columns.
Joins
If you drag the second sheet or table to the top panel but not on top of the first sheet, you'll get a join. Instead of stacking the data on top of each other, joins combines data from the sheets based on common values. In our case, both Orders and People have a column Region that we can use for the common values.
Tableau does an "inner join" by default. This combines the data wherever there is a common value. So when Region in Orders is "East", it takes the data from People where Region is "East". Above you can see the Person column from People has been added to the data from Orders.
You can click on the join symbol to change the type of join being performed. In this case you can also select the "left inner join." The normal inner join combines only data that is common, but the left inner join returns all the data in the original sheet setting rows not common to null.
It's important to understand joins because you'll be combining data often. Here's the Tableau documentation on joins, which I suggest you read if you haven't encountered joins before.